package com.bsh.erp.pro.basedata.action;

import com.bsh.erp.base.BaseAction;
import com.bsh.erp.entity.EstablishmentType;

/**
 * 单位类别 模块
 * @author JiaQi
 */
public class EstablishmentTypeAction extends BaseAction<EstablishmentType>{
	
	/**
	 * 获取全部单位类别信息，跳转到单位类别界面
	 * @author JiaQi
	 * @return 单位类别界面
	 */
	public String toEstablishmentType(){
//		获取全部单位类别
		getActionValueStack().set("establishmentTypes",establishmentTypeService.findAll());
		return "toEstablishmentType";
	}
	
	/**
	 * 删除单位类别信息
	 * @author JiaQi
	 * @return 单位类别界面
	 */
	public String delEstablishmentType(){
//		删除指定单位类别
		establishmentTypeService.delete(getModel().getId());
		
		setMessage("删除成功!");
		return toEstablishmentType();
	}
	
	/**
	 * 跳转单位类别界面
	 * @author JiaQi
	 * @return 新增 单位类别界面
	 */
	public String toEstablishmentTypeNew(){
		return "toEstablishmentTypeNew";
	}
	
	/**
	 * 保存新增 单位类别
	 * @author JiaQi
	 * @return 单位类别界面
	 */
	public String newEstablishmentType(){
//		保存单位类别
		establishmentTypeService.save(getModel());
		return toEstablishmentType();
	}
	
	/**
	 * 获取编辑 单位类别，跳转至编辑单位类别界面
	 * @author JiaQi
	 * @return 编辑单位类别界面
	 */
	public String toEstablishmentTypeEdit(){
//		获取点击 单位类别
		establishmentTypeService.getById(getModel().getId());
		return "toEstablishmentTypeEdit";
	}
	
	/**
	 * 保存编辑后的单位类别 
	 * @author JiaQi
	 * @return 单位类别界面
	 */
	public String editEstablishmentType(){
//		编辑单位类别
		establishmentTypeService.update(getModel());
		
		setMessage("保存成功！");
		return toEstablishmentType();
	}
}